/*-------------------------------------------------------------------------------------------------------- */

//  var变量提升
console.log(a)
var a = 1;

//  undefined

// console.log(b)
// let b = 1;
//  Cannot access 'c' before initialization

// console.log(c)
// const c = 1;
//  Cannot access 'c' before initialization

/*-------------------------------------------------------------------------------------------------------- */

if (true) {
    var d = 4
}
console.log(d)
//  4

// if (true) {
//     let e = 4
// }
// console.log(e)
//  e is not defined

// if (true) {
//     const f = 4
// }
// console.log(f)
//  f is not defined

/*-------------------------------------------------------------------------------------------------------- */

var g = 10;
var g = 20;
console.log(g)
//  20

// let h = 10;
// let h = 20;
// console.log(h)
//  Identifier 'h' has already been declared

// const i = 10;
// const i = 20;
// console.log(i)
//  Identifier 'i' has already been declared

/*-------------------------------------------------------------------------------------------------------- */

var j = 10;
j = 20;
console.log(j);
//  20

let k = 10;
k = 20;
console.log(k)
//  20

// const l = 10;
// l = 20;
// console.log(l)
//  Assignment to constant variable.

const m = {
    a: 1
}
m.a = 2;
console.log(m)

//  { a: 2 }
/*-------------------------------------------------------------------------------------------------------- */